use markdown_parser::parse;

#[test]
fn test_markdown_checkable_list_checked() {
    let content = "http://#33";
    let input = format!("- [ x ] {content}\n");
    let (res, errs) = parse(&input);
    if let Some(errs) = &errs {
        println!("{}", errs)
    }
    if let Some(res) = res {
        // println!("{:#?}", res);
        for ele in res.iter() {
            assert_eq!(
                ele.to_string().trim(),
                format!("<dl><li indent=\"0\" checked=\"true\">{content}</li></dl>")
            );
        }
    } else {
        panic!("链接文本解析错误");
    }
    assert!(errs.is_none())
}

#[test]
fn test_markdown_checkable_list_unchecked() {
    let content = "http://#33";
    let input = format!("- [  ] {content}\n");
    let (res, errs) = parse(&input);
    if let Some(errs) = &errs {
        println!("{}", errs)
    }
    if let Some(res) = res {
        // println!("{:#?}", res);
        for ele in res.iter() {
            assert_eq!(
                ele.to_string().trim(),
                format!("<dl><li indent=\"0\" checked=\"false\">{content}</li></dl>")
            );
        }
    } else {
        panic!("链接文本解析错误");
    }
    assert!(errs.is_none())
}
